import {get, remove, set} from './storage.util';

export const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';

// 移除浏览器端认证信息
export function removeToken(): void {
  remove(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
}

export function setToken(accessToken, tokenType): void {
  set(ACCESS_TOKEN_LOCAL_STORAGE_KEY, tokenType + ' ' + accessToken);
}

export function getToken(): string {
  return get(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
}

export function isLogined(): boolean {
  return getToken() != null;
}
